// NdaDownLoadProgressDlg.cpp : implementation file
//
// NdaDownLoadProgressDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ProgressDlg.h"

// CProgressDlg dialog

IMPLEMENT_DYNAMIC(CProgressDlg, CDialog)

CProgressDlg::CProgressDlg(CWnd* pParent /*=NULL*/)
//: CDialog(CProgressDlg::IDD, pParent)
{
	//InitModalIndirect(CRes::GetInstance().GetDialog(IDD), pParent);
	m_nCurPos = 0;

}

CProgressDlg::~CProgressDlg()
{

}

void CProgressDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CProgressDlg, CDialog)
	ON_WM_CLOSE()

	ON_BN_CLICKED(IDC_BTN_STOP_LOAD, &CProgressDlg::OnBnClickedBtnStopLoad)

END_MESSAGE_MAP()


// CProgressDlg message handlers

void CProgressDlg::OnClose()
{
	ShowWindow(SW_HIDE);
}
void CProgressDlg::Progress(int nPosLen,int nCurPos)
{
	int nPos = 0;
	INT64 nLen = 100*(INT64)nCurPos;
	if(nPosLen != 0)
		nPos= int(nLen / nPosLen);
	if(nPos == m_nCurPos)
		return;
	m_nCurPos = nPos;

	TRACE("CProgressDlg\n");
	CProgressCtrl *pProgCtrl=(CProgressCtrl*)GetDlgItem(IDC_PROGRESS);
	pProgCtrl->SetPos(nPos);
	CString strPos;
	strPos.Format(L"%d",nPos);
	strPos += "/100";
	GetDlgItem(IDC_STATIC_PROGRESS_PER)->SetWindowText(strPos);
}

void CProgressDlg::SetStaticText(CString strMsg)
{
	CStatic *pSta= (CStatic*)GetDlgItem(IDC_STATIC_PROGESS_TIP);
	pSta->SetWindowText(strMsg);
	
}


BOOL CProgressDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  Add extra initialization here

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}

void CProgressDlg::OnBnClickedBtnStopLoad()
{

}

//void CProgressDlg::OnBnClickedBtnHideProgress()
//{
//	// TODO: Add your control notification handler code here
//	ShowWindow(SW_HIDE);
//}
